import 'dart:convert';
import 'package:meta/meta.dart';

class Company {
  final String logo;
  final String name;
  final String location;
  final String type;
  final String size;
  final String employee;
  final String hot;
  final String count;
  final String inc;
  //final List<String> images;
  final List  images;

  Company({
    @required this.logo, //logo
    @required this.name, // 公司名称
    @required this.location, // 公司位置
    @required this.type, //公司性质
    @required this.size, // 公司规模
    @required this.employee, //公司人数
    @required this.hot, //热招职位
    @required this.count, //职位总数
    @required this.inc, //公司详情
    @required this.images, //轮播图部分的图片
  });

//  json 数据转换
  static List<Company> fromJson(String json) {
    List<Company> _coms = [];
    JsonDecoder decoder = new JsonDecoder();
    var mapdata = decoder.convert(json)['list'];
    mapdata.forEach((obj) {
      Company com = new Company(
        logo: obj['logo'],
        name: obj['name'],
        location: obj['location'],
        type: obj['type'],
        size: obj['size'],
        employee: obj['employee'],
        hot: obj['hot'],
        count: obj['count'],
        inc: obj['inc'],
        images: obj['images']
      );
      _coms.add(com);
    });
    return _coms;
  }
}
